using System;
using L=Science.Physics.GeneralPhysics;

namespace Serway.Chapter33
{
	/// <summary>
	/// Example06: Average Power in an RLC Series Circuit
	/// Calculate the average power delivered to the series 
	/// RLC circuit described in Example 33.5
	/// </summary>
	public class Example06
	{
		public Example06()
		{
		}
		private string result;
		public string Result
		{
			get{return result;}
		}
		public void Compute()
		{
			L.Resistance R = new L.Resistance();
			R.Ohm = 425.0;
			L.Inductance LL = new L.Inductance();
			LL.H = 1.25;
			L.Capacitance C = new L.Capacitance();
			C.F = 3.5E-6;
			L.Frequency f = new L.Frequency();
			f.Hz = 377.0/2/Math.PI;
			L.ElectricPotentialDifference V
				= new L.ElectricPotentialDifference();
			V.V = 150.0/Math.Sqrt(2.0);
			L.CircuitRLC cir = new L.CircuitRLC(R,LL,C);
			L.ElectricCurrent I = new L.ElectricCurrent();
			I.A = V.V/cir.Impedance(f);
			L.ElectricPower P = new L.ElectricPower(I,V);
			P.W *= cir.PowerFactor(f);
			result+=Convert.ToString(P.W)+"\r\n";   
		}
	}
}
